package com.deyuanyun.pic.pbf.app.enumeration;

/**
 * @author Jerry
 * @Description 缺陷类型码表
 * @date 2016-12-23
 */
public enum DefectTypeCode {

    ML("1E3290704BF1749EE0530E0AA8C09710", "金属损失"),
    DENT("1E3290704BF1749EE0530E0AA8C09720", "凹陷"),
    WAN("1E3290704BF1749EE0530E0AA8C09730", "焊缝异常"),
    OVAL("1E3290704BF1749EE0530E0AA8C09740", "椭圆变形"),
    CRAC("1E3290704BF1749EE0530E0AA8C09750", "类裂纹"),
    OTHE("1E3290704BF1749EE0530E0AA8C09760", "损伤缺陷");

    private String code;
    private String label;

    DefectTypeCode(String code, String label) {
        this.code = code;
        this.label = label;
    }


    public static DefectTypeCode getVal(String code) {

        DefectTypeCode rs[] = DefectTypeCode.values();
        for (int i = 0, end = rs.length; i < end; i++) {
            if (rs[i].getCode().equals(code)) {
                return rs[i];
            }
        }
        return null;
    }

    public static String getLabelBycode(String code) {
        DefectTypeCode rs[] = DefectTypeCode.values();
        for (int i = 0; i < rs.length; i++) {
            if (rs[i].toString().equals(code)) {
                return rs[i].getLabel();
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }
}
